package cloud.xlh.digital_power_card.facade.card.impl;

import cloud.xlh.digital_power_card.client.card.dto.OpenCardDTO;
import cloud.xlh.digital_power_card.client.card.service.CardClientService;
import cloud.xlh.digital_power_card.domian.card.CardSaveDomain;
import cloud.xlh.digital_power_card.intergration.card.adapter.CardClientAdapter;
import cloud.xlh.digital_power_card.service.card.CardService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2023/8/30 16:30
 * @ Description:
 */
@Service
public class CardClientServiceImpl implements CardClientService {
    @Resource
    private CardService cardService;
    @Resource
    private CardClientAdapter cardClientAdapter;

    @Override
    public String selectCard(String cardId) {
        return cardService.selectCard(cardId);
    }

    @Override
    public String openCard(OpenCardDTO openCardDTO) {
        CardSaveDomain cardSaveDomain = cardClientAdapter.convertCardSaveDomain(openCardDTO);
        return cardService.openCard(cardSaveDomain);
    }
}
